import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 导入全局样式表
import './assets/css/global.css'
// 导入axios
import axios from 'axios'
// 配置请求的根路径
axios.defaults.baseURL = 'http://hekvn.top:3000/api/v1/'
// 设置请求拦截器。携带token
axios.interceptors.request.use(config => {
  const token = window.sessionStorage.getItem('token')
  // 我后端设置的请求头 token前面要加Bearer
  config.headers.Authorization = `Bearer ${token}`
  // 在最后必须return config
  return config
})
Vue.prototype.$http = axios

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
